﻿using M_Purchase.Api.Appliction.Command.PurchCommand;
using M_Purchase.Domain;
using M_Purchase.Repository.PurchaseInterface;
using MediatR;

namespace M_Purchase.Api.Appliction.CommandHandlers.PurchCommandHandler
{
    /// <summary>
    /// 显示物流信息
    /// </summary>
    public class LogisticsListCommandHandler : IRequestHandler<LogisticsListCommand, List<Logistics>>
    {
        private readonly ILogisticsRepository _logisticsRepository;
        public LogisticsListCommandHandler(ILogisticsRepository logisticsRepository)
        {
         
            _logisticsRepository = logisticsRepository;
        }
        public async Task<List<Logistics>> Handle(LogisticsListCommand request, CancellationToken cancellationToken)
        {
            return await _logisticsRepository.GetAsync(d => d.PurchaseID == request.PurchaseID && d.SupplierID == request.SupplierID);
        }
    }
}
